<template>
  <Layout>
    <!-- Page Header -->
    <header class="masthead" style="background-image: url('/img/home-bg.jpg')">
      <div class="overlay"></div>
      <div class="container">
        <div class="row">
          <div class="col-lg-8 col-md-10 mx-auto">
            <div class="site-heading">
              <h1>{{$page.tag.name}}</h1>
              <span class="subheading">A Blog Theme by Start Bootstrap</span>
            </div>
          </div>
        </div>
      </div>
    </header>

    <!-- Main Content -->
    <div class="container">
      <div class="row">
        <div class="col-lg-8 col-md-10 mx-auto">
          <div class="post-preview" v-for="article in $page.tag.articles" :key="article.id">
            <a href="post.html">
              <h2 class="post-title">{{article.title}}</h2>
              <!-- <h3 class="post-subtitle">Problems look mighty small from 150 miles up</h3> -->
            </a>
            <p class="post-meta">
              Posted by
              <a href="#">
                {{article.createdBy.firstname}}
                {{article.createdBy.lastname}}
              </a>
              {{article.published_at}}
            </p>
            <hr />
          </div>
          <!-- Pager -->
          <!-- <div class="clearfix">
            <a class="btn btn-primary float-right" href="#">Older Posts &rarr;</a>
          </div>-->
          <!-- <Pager :info="$page.articles.pageInfo" /> -->
        </div>
      </div>
    </div>
  </Layout>
</template>

<page-query>
query ($id: ID) {
  tag: strapiTag(id: $id) {
    id
    name
    articles {
      id
      title
      published_at
      createdBy
    }
  }
}
</page-query>

<script>
export default {
  name: "TagPage"
};
</script>